"""
Copyright 2009 Texas A&M University
 
Licensed under the Apache License, Version 2.0 (the "License"); you may not use 
this file except in compliance with the License. You may obtain a copy of the 
License at

http://www.apache.org/licenses/LICENSE-2.0
  
Unless required by applicable law or agreed to in writing, software distributed 
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 
CONDITIONS OF ANY KIND, either express or implied. See the License for the 
specific language governing permissions and limitations under the License. 
"""

import zope.interface



class IMetalibConnection(zope.interface.Interface):
    def post(self, operation, **kwargs):
        """ Post the given operation to the x server with the provided 
        data from keyword arguments """
    
    def connect(self):
        """ Return a new IMetalibSession object """
    
class IMetalibSession(zope.interface.Interface):
    def post(self, operation, **kwargs):
        """ Post to the connection that this session was created from, add the
        required session information into the post data """
    
    def find(self, command, base, wait=False, filter={}, application=None):
        """ Perform a find command on the xserver """
    
    def retrieveQuickSets(self, association, filter={}):
        """ Retrieve the quick sets based on the given association
        
        Association should be a dictionary. There are three options for its 
        contents:
        
        1. {'ip': requester_ip_address }
        2. {'source': source_id, 'institute': institute, 'verification': verification}
        3. {'borrower': bor_id, 'verification': verification}
        4. {'pds_handle': pds_handle}
        """
    
    def searchQuickSet(self, set, command, wait=False, filter={},
                       application=None):
        """ Perform a search of a quick set """
    
    def searchMySet(self, set, command, wait=False, application=None):
        """ Perform a search of one of 'my' sets """
    
    def present(self, set_number, set_entry=None, doc_number=None, format=None,
                view=None, field=None, subfield=None, full_text=False,
                add_proxy=False, requester_ip=None):
        """ """
    
    def retrieveClusterFacet(self,  set_number, type=None, application=None,
                             institution=None):
        """ """

class IMetalibGroup(zope.interface.Interface):
    def post(self, operation, **kwargs):
        """ Post to the connection/session that this group was created from, 
        add the required group information into the post data """
    
    def status(self):
        """ Wrapper for find_group_info """
    
    def merge_sort(self, action, sort_key=None, secondary_sort_key=None,
                   fetch_more=None, application=None):
        """ Action should be one of ['merge','merge_more','remerge','sort_only'] """
    